package cn.com.manager.controller;

import javax.servlet.ServletContext;

import org.apache.shiro.SecurityUtils;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import cn.com.manager.pojo.User;

/**
 * Created by Administrator on 2016/4/22.
 */
public class BaseController {
    public ServletContext servletContext;

    public BaseController() {
        WebApplicationContext currentWebApplicationContext = ContextLoader.getCurrentWebApplicationContext();
        this.servletContext = currentWebApplicationContext.getServletContext();
    }
    
    public User getCurrentUser(){
    	User user = (User)SecurityUtils.getSubject().getPrincipal();
    	return user;
    }
}
